home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 2
/
Atari Mega Archive CD - Volume 2.iso
/
minix
/
up1510b.tgz
/
up1510b
/
src
/
mm
/
signal.c.D
< prev
next >
Wrap
Text File
|
1990-07-25
|
9KB
|
290 lines
*** /tmp/,RCSt1022405 Wed Jul 25 13:59:45 1990
--- signal.c Mon Jul 23 21:37:33 1990
***************
*** 17,27 ****
! #include "../h/const.h"
! #include "../h/type.h"
! #include "../h/callnr.h"
! #include "../h/com.h"
! #include "../h/error.h"
! #include "../h/signal.h"
! #include "../h/stat.h"
! #include "const.h"
! #include "glo.h"
#include "mproc.h"
--- 17,24 ----
!
! #include "mm.h"
! #include <sys/stat.h>
! #include <signal.h>
! #include <minix/callnr.h>
! #include <minix/com.h>
#include "mproc.h"
***************
*** 35,36 ****
--- 32,41 ----
+ #if AM_KERNEL
+ PRIVATE int Tfs; /* if true then Tell file server to unpause */
+ #endif
+
+ FORWARD int check_sig();
+ FORWARD void dump_core();
+ FORWARD void unpause();
+
/*===========================================================================*
***************
*** 44,48 ****
! int mask, oldign;
! if (sig < 1 || sig > NR_SIGS) return(EINVAL);
if (sig == SIGKILL) return(OK); /* SIGKILL may not ignored/caught */
--- 49,54 ----
! int mask;
! int sigign = mp->mp_ignore;
! if (sig < 1 || sig > _NSIG) return(EINVAL);
if (sig == SIGKILL) return(OK); /* SIGKILL may not ignored/caught */
***************
*** 49,51 ****
mask = 1 << (sig - 1); /* singleton set with 'sig' bit on */
- oldign = mp->mp_ignore;
--- 55,56 ----
***************
*** 63,66 ****
}
! if (oldign & mask)
! return(1);
return(OK);
--- 68,71 ----
}
!
! if (sigign & mask) return(1);
return(OK);
***************
*** 93,95 ****
register struct mproc *rmp;
! int i, proc_id, proc_nr, id;
unshort sig_map; /* bits 0 - 15 for sigs 1 - 16 */
--- 98,100 ----
register struct mproc *rmp;
! int i, j, proc_id, proc_nr, id;
unshort sig_map; /* bits 0 - 15 for sigs 1 - 16 */
***************
*** 96,99 ****
! /* Only kernel and FS may make this call. */
! if (who != HARDWARE && who != FS_PROC_NR) return(EPERM);
--- 101,105 ----
! /* Only kernel may make this call. */
! if (who != HARDWARE) return(EPERM);
! dont_reply = TRUE; /* don't reply to the kernel */
***************
*** 108,110 ****
/* Stack faults are passed from kernel to MM as pseudo-signal 16. */
! if (sig_map == 1 << (STACK_FAULT - 1))
stack_fault(proc_nr);
--- 114,116 ----
/* Stack faults are passed from kernel to MM as pseudo-signal 16. */
! if (sig_map == 1 << (SIGSTKFLT - 1))
stack_fault(proc_nr);
***************
*** 116,121 ****
*/
! for (i = 0; i < NR_SIGS-1; i++) {
! id= (i+1 == SIGINT || i+1 == SIGQUIT ? 0 : proc_id);
! if (i + 1 == SIGKILL) id = -1; /* simulate kill -1 9 */
! if ( (sig_map >> i) & 1) check_sig(id, i + 1, SUPER_USER);
}
--- 122,130 ----
*/
! for (i = 0, j = 1; i < _NSIG - 1; i++, j++) {
! id = (j == SIGINT || j == SIGQUIT) ? 0 : proc_id;
! if (j == SIGKILL) id = -1; /* simulate kill -1 9 */
! if ( (sig_map >> i) & 1) {
! check_sig(id, j, SUPER_USER);
! sys_sig(proc_nr, -1, SIG_DFL); /* tell kernel it's done */
! }
}
***************
*** 122,124 ****
- dont_reply = TRUE; /* don't reply to the kernel */
return(OK);
--- 131,132 ----
***************
*** 133,135 ****
int sig_nr; /* which signal to send (1-16) */
! uid send_uid; /* identity of process sending the signal */
{
--- 141,143 ----
int sig_nr; /* which signal to send (1-16) */
! uid_t send_uid; /* identity of process sending the signal */
{
***************
*** 143,147 ****
unshort mask;
- extern unshort core_bits;
! if (sig_nr < 1 || sig_nr > NR_SIGS) return(EINVAL);
count = 0; /* count # of signals sent */
--- 151,154 ----
unshort mask;
! if (sig_nr < 1 || sig_nr > _NSIG) return(EINVAL);
count = 0; /* count # of signals sent */
***************
*** 155,159 ****
*/
! for (rmp = &mproc[INIT_PROC_NR + 1]; rmp < &mproc[NR_PROCS]; rmp++ ) {
if ( (rmp->mp_flags & IN_USE) == 0) continue;
! send_sig = TRUE; /* if it's FALSE at end of loop, don't signal */
if (send_uid != rmp->mp_effuid && send_uid != SUPER_USER)send_sig=FALSE;
--- 162,166 ----
*/
! for (rmp = &mproc[INIT_PROC_NR]; rmp < &mproc[NR_PROCS]; rmp++ ) {
if ( (rmp->mp_flags & IN_USE) == 0) continue;
! send_sig = TRUE; /* if it's FALSE at end of loop, don't signal*/
if (send_uid != rmp->mp_effuid && send_uid != SUPER_USER)send_sig=FALSE;
***************
*** 161,164 ****
if (rmp->mp_flags & HANGING) send_sig = FALSE; /*don't wake the dead*/
! if (proc_id == 0 && mp->mp_procgrp != rmp->mp_procgrp) send_sig = FALSE;
if (send_uid == SUPER_USER && proc_id == -1) send_sig = TRUE;
--- 168,173 ----
if (rmp->mp_flags & HANGING) send_sig = FALSE; /*don't wake the dead*/
! if (proc_id == 0 && mp->mp_procgrp != rmp->mp_procgrp)send_sig = FALSE;
if (send_uid == SUPER_USER && proc_id == -1) send_sig = TRUE;
+ if (rmp->mp_pid == INIT_PID && proc_id == -1) send_sig = FALSE;
+ if (rmp->mp_pid == INIT_PID && sig_nr == SIGKILL) send_sig = FALSE;
***************
*** 177,178 ****
--- 186,192 ----
+ #if AM_KERNEL
+ /* see if an amoeba transaction should be signalled */
+ Tfs = am_check_sig((int)(rmp - mproc), 0);
+ #endif
+
/* Send the signal or kill the process, possibly with core dump. */
***************
*** 186,188 ****
/* If the calling process has killed itself, don't reply. */
! if ((mp->mp_flags & IN_USE) == 0 || (mp->mp_flags & HANGING))dont_reply =TRUE;
return(count > 0 ? OK : ESRCH);
--- 200,202 ----
/* If the calling process has killed itself, don't reply. */
! if ((mp->mp_flags & IN_USE) == 0 || (mp->mp_flags & HANGING))dont_reply=TRUE;
return(count > 0 ? OK : ESRCH);
***************
*** 194,196 ****
*===========================================================================*/
! PUBLIC sig_proc(rmp, sig_nr)
register struct mproc *rmp; /* pointer to the process to be signaled */
--- 208,210 ----
*===========================================================================*/
! PUBLIC void sig_proc(rmp, sig_nr)
register struct mproc *rmp; /* pointer to the process to be signaled */
***************
*** 207,209 ****
vir_bytes new_sp;
- extern unshort core_bits;
--- 221,222 ----
***************
*** 210,211 ****
--- 223,229 ----
if ( (rmp->mp_flags & IN_USE) == 0) return; /* if already dead forget it */
+ if (rmp->mp_flags & TRACED && sig_nr != SIGKILL) {
+ /* A traced process has special handling. */
+ stop_proc(rmp, sig_nr); /* a signal causes it to stop */
+ return;
+ }
mask = 1 << (sig_nr - 1);
***************
*** 290,292 ****
*===========================================================================*/
! PUBLIC unpause(pro)
int pro; /* which process number */
--- 308,310 ----
*===========================================================================*/
! PRIVATE void unpause(pro)
int pro; /* which process number */
***************
*** 313,315 ****
if ( (rmp->mp_flags & WAITING) && (rmp->mp_flags & HANGING) == 0) {
! rmp->mp_flags &= ~ WAITING; /* turn off WAITING bit */
reply(pro, EINTR, 0, NIL_PTR);
--- 331,333 ----
if ( (rmp->mp_flags & WAITING) && (rmp->mp_flags & HANGING) == 0) {
! rmp->mp_flags &= ~WAITING; /* turn off WAITING bit */
reply(pro, EINTR, 0, NIL_PTR);
***************
*** 318,321 ****
/* Process is not hanging on an MM call. Ask FS to take a look. */
! tell_fs(UNPAUSE, pro, 0, 0);
--- 336,343 ----
+ #if AM_KERNEL
+ /* if it was an amoeba transaction, it is already tidied up by now. */
+ if (Tfs)
+ #endif
/* Process is not hanging on an MM call. Ask FS to take a look. */
! tell_fs(UNPAUSE, pro, 0, 0);
***************
*** 328,330 ****
*===========================================================================*/
! PRIVATE dump_core(rmp)
register struct mproc *rmp; /* whose core is to be dumped */
--- 350,352 ----
*===========================================================================*/
! PRIVATE void dump_core(rmp)
register struct mproc *rmp; /* whose core is to be dumped */
***************
*** 339,343 ****
struct mproc *xmp;
! extern char core_name[];
-
/* Change to working directory of dumpee. */
--- 361,365 ----
stru